<?php
//得到用户此次输入的正常状态的食品信息
function getUserNormalFoodData($login_mail)
{ 	
	$userId = getUserId($login_mail);
	//当前时间
	$sqltime = mysql_query("SELECT `create_time` FROM `food_user_basic` WHERE `id` = '$userId'") or die(mysql_error());
	$rowtime = mysql_fetch_array($sqltime,MYSQL_ASSOC);
	$todayDate = substr($rowtime['create_time'],0,10);
	
	$data = array();
	
	
	$sql = "SELECT `food_user_data`.`id`,`food_user_data`.`eatwhat`,`food_user_data`.`eathowmany`,`food_user_data`.`create_time` FROM `food_user_data`
			INNER JOIN `food_user_basic` ON `food_user_basic`.`id` = `food_user_data`.`user_id`
			WHERE `food_user_data`.`history_data` = 0 AND `food_user_basic`.`user_mail` = '".$login_mail."' 
			ORDER BY `food_user_data`.`create_time` ASC";
	$query = mysql_query($sql) or die(mysql_error());
	while($row = mysql_fetch_array($query))
	{
		$createTime = substr($row['create_time'],0,10);
		if($todayDate == $createTime):
		$data[] = array("data_id"=>"$row[id]","eatwhat"=>"$row[eatwhat]","eathowmany"=>"$row[eathowmany]","create_time"=>"$row[create_time]");
		endif;
	}
	
	return $data;
	
}

function getFoodCategory()
{
	$sql = "SELECT `category` FROM `food_category` WHERE `data_status` = 1";
	$query = mysql_query($sql)or die(mysql_error());
	$i = 0;
	while($row = mysql_fetch_array($query))
	{
		$category[$i] = $row['category'];
		$i++;
	}
	return $category;
}
?>